"use client"
import {useState} from "react";
import Link from "next/link";
import {usePathname} from "next/navigation";

export default function DashboardLayout(
    {
        children,
    }: Readonly<{
        children: React.ReactNode;
    }>) {
    const [count, setCount] = useState(0)
    const pathname = usePathname()
    return (
        <div>
            <div>
                <div>
                    <div>当前的pathname: {pathname}</div>
                    <div className='flex justify-start items-center gap-2'>
                        <span>dashboard count: {count}</span>
                        <button className='border-2'
                                onClick={() => setCount(count + 1)}>dashboard count + 1
                        </button>
                    </div>
                </div>
                <div className='flex gap-6'>
                    <Link className='border-2' href={"/dashboard/news"}>news</Link>
                    <Link className='border-2' href={"/dashboard/rank"}>rank</Link>
                </div>
                {children}
            </div>
        </div>
    );
}
